package com.qidian.mespro.controller;

import com.github.pagehelper.PageInfo;

import com.qidian.mespro.service.ProductionOrderService;
import com.qidian.mespro.vo.ProductionOrderVO;
import com.qidianit.mes.pojo.Result;

import com.qidianit.mes.pojo.pro.ProductionOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ Description:
 * @ Author: DuYaTao
 * @ Date: 2025/9/22 - 16:05
 */
@RestController
@RequestMapping("/productionOrder")
public class ProductionOrderController {
    @Autowired
    private ProductionOrderService productionOrderService;

    @GetMapping("/list")
    public Result<PageInfo<ProductionOrder>> selectAll(ProductionOrderVO productionOrderVO, @RequestParam(defaultValue = "1") int pageNum , @RequestParam(defaultValue = "10") int pageSize){
        System.out.println(productionOrderVO);
        return productionOrderService.selectAll(productionOrderVO, pageNum, pageSize);
    }

    @GetMapping("/{id}")
    public Result<ProductionOrder> selectById(@PathVariable("id") Integer id){
        return productionOrderService.selectById(id);
    }

    @PostMapping("/add")
    public Result insertAll(ProductionOrder productionOrder){
        return productionOrderService.insertAll(productionOrder);
    }
}
